package com.lqk.shardingjdbcproj.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.lqk.shardingjdbcproj.entity.Course;
import com.lqk.shardingjdbcproj.entity.User;
import com.lqk.shardingjdbcproj.mapper.CourseMapper;
import com.lqk.shardingjdbcproj.mapper.UserMapper;
import com.lqk.shardingjdbcproj.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserMapper userMapper;

    @Override
    public int insertCourse(User user) {
        int insert = userMapper.insert(user);
        return insert;
    }

    @Override
    public User selectOne(long userId) {
        QueryWrapper<User> wrapper = new QueryWrapper<>();
        wrapper.eq("user_id",userId);
        return userMapper.selectOne(wrapper);
    }
}
